package com.sm.auth.utils;

import com.sm.auth.vo.LoginUserVo;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

public class SecurityUtil {

    //获取当前用户权限
    private static Authentication getAuthentication(){
        return SecurityContextHolder.getContext().getAuthentication();
    }
    //获取当前用户
    public static LoginUserVo getCurrentUser(){
        return (LoginUserVo) getAuthentication().getPrincipal();
    }

}
